package com.smartcruise.util.sortLetter;

/**
 * Created by FengChaoQun
 * on 2016/7/27
 */

import java.util.Comparator;

/**
 * @author xiaanming
 */
public class PinyinComparator implements Comparator<SortModel> {

    public int compare(SortModel o1, SortModel o2) {
        //如果有多少特殊值 则比较特殊值
        if (o1.getRemark() != 0 || o2.getRemark() != 0) {
            if (o1.getRemark() < o2.getRemark()) {
                return 1;
            } else if (o1.getRemark() > o2.getRemark()) {
                return -1;
            } else {
                return 0;
            }
        }
        //这里主要是用来对ListView里面的数据根据ABCDEFG...来排序
        if (o2.getSortLetters().equals("#")) {
            return -1;
        } else if (o1.getSortLetters().equals("#")) {
            return 1;
        } else {
            return o1.getSortLetters().compareTo(o2.getSortLetters());
        }
    }
}
